home *** CD-ROM | disk | FTP | other *** search
- class Grid
- {
- var width;
- var xNum;
- var yNum;
- var area;
- function Grid(__width, w, h, arr)
- {
- this.width = __width;
- this.xNum = w;
- this.yNum = h;
- this.area = arr;
- }
- function push(x, y, mc, name)
- {
- var _loc3_ = undefined;
- var _loc2_ = undefined;
- var _loc6_ = undefined;
- _loc3_ = Math.floor(x / this.width);
- _loc2_ = Math.floor(y / this.width);
- this.area[_loc3_][_loc2_][name].push(mc);
- }
- function pop(x, y, mc, name)
- {
- var _loc4_ = undefined;
- var _loc3_ = undefined;
- var _loc2_ = undefined;
- _loc4_ = Math.floor(x / this.width);
- _loc3_ = Math.floor(y / this.width);
- _loc2_ = 0;
- while(_loc2_ < this.area[_loc4_][_loc3_][name].length)
- {
- if(this.area[_loc4_][_loc3_][name][_loc2_] == mc)
- {
- trace(this.area);
- this.area[_loc4_][_loc3_][name].splice(_loc2_,1);
- trace(this.area);
- break;
- }
- _loc2_ = _loc2_ + 1;
- }
- }
- }
-